package com.example.wechattakeaway.mapper;

import com.example.wechattakeaway.entity.SysUser;
import com.example.wechattakeaway.form.userform.ChangePwdForm;
import com.example.wechattakeaway.form.userform.InsertUserForm;
import com.example.wechattakeaway.form.userform.LoginForm;
import com.example.wechattakeaway.form.userform.UpdateUserForm;
import com.example.wechattakeaway.vo.ResultVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface SysUserMapper {

    /*
    用户注册
    @param InsertUserForm
    @return null
     */
    Integer UserRegister(SysUser sysUser);

    /*
    用户更新
    @param UpdateUserForm
    @return null
     */
    Integer UpdateUser(UpdateUserForm updateUserForm);

    /*
    用户更改密码
    @param ChangePwdForm
    @return null;
     */
    Integer UserChangerPwd(@Param("sysuserName") String sysuserName,@Param("newPwd") String newPwd);

    /*
    更新用户角色
    @param userRole,sysuserId
    @return null
     */
    Integer UpdateUserRole(@Param("userRole") Integer userRole,@Param("sysuserId") Integer sysuserId);

    /*
    根据id查询用户信息
    @param sysuserId
    @return SysUser
     */
    SysUser SelectUserById(Integer sysuserId);

    /*
    测试查询所有的用户
    @param null
    @return List<SysUser>
     */
    List<SysUser> SelectAllUser();

    /*
    根据id删除用户
    @param sysuserId
    @return null
     */
    Integer DeleteUserById(String sysuserName);

    /*
    根据用户名查询到用户信息
    @param sysuserName
    @return SysUser
     */
    SysUser SelectUserByName(String sysuserName);
}